package com.lagou.id;

import ch.qos.logback.classic.spi.EventArgUtil;
import org.apache.shardingsphere.core.strategy.keygen.SnowflakeShardingKeyGenerator;
import org.apache.shardingsphere.spi.keygen.ShardingKeyGenerator;

import java.util.Properties;

/**
 * @author Mrwg
 * @date 2023/5/26 20:52
 * @description
 */

/**
 * 自定义主键生成器
 */
public class MID implements ShardingKeyGenerator {
    private SnowflakeShardingKeyGenerator snowflake = new SnowflakeShardingKeyGenerator();

    @Override
    public Comparable<?> generateKey() {
        System.out.println("自定义主键");
        return snowflake.generateKey();
    }

    @Override
    public String getType() {
        return "MKEY";
    }

    @Override
    public Properties getProperties() {
        return null;
    }

    @Override
    public void setProperties(Properties properties) {

    }
}
